//
//  MePurseSectionHeadCell.m
//  HTHappySale
//
//  Created by 创维海通 on 2017/9/25.
//  Copyright © 2017年 zxyywy. All rights reserved.
//

#import "MePurseSectionHeadCell.h"
#import "MeHTModel.h"
@interface MePurseSectionHeadCell()
@property (strong, nonatomic) IBOutlet UILabel *totalLabel;

@end

@implementation MePurseSectionHeadCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    UITapGestureRecognizer *action = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backAction)];
    self.userInteractionEnabled = YES;
    [self addGestureRecognizer:action];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configureCell:(MePurseModel *)model
{
    NSString *moneyStr =[NSString stringWithFormat:@"%.2f元",model.surplus];
    NSInteger len = [moneyStr length];
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:moneyStr];
    
    [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, len-1)];
    [str addAttribute:NSForegroundColorAttributeName value:HTCFQuickRGBColor(159,159,159) range:NSMakeRange(len-1, 1)];
    _totalLabel.attributedText = str;
}

- (void)backAction{
    if ([_headDelegate respondsToSelector:@selector(skipController)]) {
        [_headDelegate performSelector:@selector(skipController) withObject:self];
    }
}

@end
